<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="UTF-8" />
    <title>Toolbar - Title</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
    <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
    <script src="../../../../../scripts/testing/scripts.js"></script>
    <script nomodule src="../../../../../dist/ionic/ionic.js"></script>
    <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>

    <style>
      .more,
      .create {
        --dimension: 28px;
        width: var(--dimension);
        height: var(--dimension) !important;
        --border-radius: var(--dimension) !important;
      }
      .more {
        --background: #e9e9ea;
      }

      .create {
        --background: #3777ff;
        --color: white !important;
      }

      .create ion-icon {
        transform: scale(0.9);
      }

      .main-toolbar {
        --background: rgba(0, 0, 0, 0.05);
      }
    </style>
  </head>

  <body>
    <ion-app>
      <ion-nav root="page-one"></ion-nav>
    </ion-app>

    <style>
      ion-item {
        --padding-start: 10px;
      }

      .item-badge {
        padding: 0;
        margin-top: 14px;
        margin-right: 10px;
        width: 14px;
        height: 14px;
      }
    </style>

    <script>
      class PageOne extends HTMLElement {
        generateList() {
          let html = '';
          for (let i = 0; i < 100; i++) {
            html += `
            <ion-nav-link component="page-three">
              <ion-item button>
                <ion-badge slot="start" class="item-badge ion-align-self-start">&nbsp;</ion-badge>
                <ion-label>
                  <h2>Heading ${i}</h2>
                  <h3>Smaller heading ${i}</h2>
                  <p>Paragraph ${i}</p>
                </ion-label>

              </ion-item>
            </ion-nav-link>
          `;
          }
          return html;
        }

        connectedCallback() {
          this.innerHTML = `
          <ion-header class="main-header" translucent>
            <ion-toolbar class="main-toolbar">
              <ion-segment>
                <ion-segment-button value="all">
                  All
                </ion-segment-button>
                <ion-segment-button value="favorites">
                  Favorites
                </ion-segment-button>
              </ion-segment>
            </ion-toolbar>

            <ion-toolbar class="main-toolbar">
              <ion-segment>
                <ion-segment-button value="all">
                  All
                </ion-segment-button>
                <ion-segment-button value="favorites">
                  Favorites
                </ion-segment-button>
              </ion-segment>
            </ion-toolbar>

            <ion-toolbar class="main-toolbar">
              <ion-buttons collapse>
                <ion-back-button default-href="/"></ion-back-button>
              </ion-buttons>
              <ion-title>Page Two</ion-title>
              <ion-buttons slot="end">
                <ion-button>Hello Page 2</ion-button>
              </ion-buttons>
            </ion-toolbar>
          </ion-header>

          <ion-content id="content" class="main-content" fullscreen>
            <ion-header collapse="condense">
              <ion-toolbar>
                <ion-title size="large">Page Two</ion-title>
              </ion-toolbar>
              <ion-toolbar>
                <ion-searchbar></ion-searchbar>
              </ion-toolbar>
            </ion-header>

            <ion-list id="dynamicList">${this.generateList()}</ion-list>
          </ion-content>
        `;
        }
      }

      class PageThree extends HTMLElement {
        generateList() {
          let html = '';
          for (let i = 0; i < 100; i++) {
            html += `
            <ion-item button color="dark">
              <ion-badge slot="start" class="item-badge ion-align-self-start">&nbsp;</ion-badge>
              <ion-label>
                <h2>Heading ${i}</h2>
                <h3>Smaller heading ${i}</h2>
                <p>Paragraph ${i}</p>
              </ion-label>

            </ion-item>
          `;
          }
          return html;
        }

        connectedCallback() {
          this.innerHTML = `
          <ion-header class="three-header" color="dark" translucent>
            <ion-toolbar color="dark">
              <ion-buttons>
                <ion-back-button default-href="/" text="Page Two"></ion-back-button>
              </ion-buttons>
              <ion-title>Page Three</ion-title>
              <ion-buttons slot="end" collapse>
                <ion-button>Hello Page 3</ion-button>
              </ion-buttons>
            </ion-toolbar>
          </ion-header>

          <ion-content id="content" class="three-content" fullscreen color="dark">
            <ion-header collapse="condense" color="dark">
              <ion-toolbar color="dark">
                <ion-title size="large">Page Three</ion-title>
              </ion-toolbar>
            </ion-header>

            <ion-list id="dynamicList">${this.generateList()}</ion-list>
          </ion-content>
        `;
        }
      }
      customElements.define('page-one', PageOne);
      customElements.define('page-three', PageThree);
    </script>
  </body>
</html>
